package com.suzj.extraenchantments.cap;



import java.util.HashMap;
import java.util.Map;


public class CoolDownStandardImpl implements ICoolDown {
    private Map<CoolDownType, Integer> coolDownMap = new HashMap();

    public CoolDownStandardImpl() {
        for (CoolDownType coolDownType : CoolDownType.values()) {
            this.coolDownMap.put(coolDownType, 0);
        }
    }

    @Override
    public int get(CoolDownType coolDownType) {
        return this.coolDownMap.get(coolDownType).intValue();
    }

    @Override
    public boolean isReady(CoolDownType coolDownType) {
        return this.coolDownMap.get(coolDownType).intValue() < 1;
    }

    @Override
    public void set(CoolDownType coolDownType, int coolDownTick) {
        this.coolDownMap.put(coolDownType, Integer.valueOf(Math.max(0, coolDownTick)));
    }

    @Override
    public void decrease(CoolDownType coolDownType) {
        if (!isReady(coolDownType)) {
            this.coolDownMap.put(coolDownType, Integer.valueOf(this.coolDownMap.get(coolDownType).intValue() - 1));
        }
    }

    @Override
    public Map<CoolDownType, Integer> getMap() {
        return this.coolDownMap;
    }

    @Override
    public void setMap(Map<CoolDownType, Integer> coolDownMap) {
        this.coolDownMap = coolDownMap;
    }
}